﻿
@using (Ajax.BeginForm("DeptPartialView", "System", new AjaxOptions
    {
        HttpMethod = "POST",
        //OnBegin = "function(){ loadingPanel.Show(); }",
        //OnComplete = "function(){ loadingPanel.Hide(); }",
        UpdateTargetId = "list-dept",
        InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace
        
    }))
    {
        @UserQuery.CreateQuery(setting => {
           setting.Columns.Add(new QueryColumn() { Field = "deptname", Name = "单位名称" });
        })
}

<div id="list-dept">
    @Html.Action("DeptPartialView")
</div>


<br />
 @Html.DevExpress().Button(settings =>
{
    settings.Name = "btnAdd";
    settings.Text = "增加单位";
    settings.Width = 100;
    settings.ControlStyle.CssClass = "button1";
    settings.ClientSideEvents.Click = "function(s, e){edit(); }";
}).GetHtml()
<script type="text/javascript">
    var deptId = null;
    function edit(id) {
        deptId = id;
        pcModalMode.Show();
    }
    function OnBeginCallback(s, e) {
        e.customArgs["id"] = deptId;
        deptId = null;
    }
    function OnEndCallback(s, e) {
    }
</script>



@Html.DevExpress().PopupControl(
settings =>
{
    settings.Name = "pcModalMode";
    settings.CallbackRouteValues = new { Controller = "System", Action = "EditDept" };
    settings.Width = 410;
    settings.Height = 200;
    settings.InitDefaultSettings();
    
    settings.HeaderText = "部门信息编辑";
}).GetHtml()
